import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 回收品类信息 */
export interface Category {
          categoryName?: string; // 品类名称(如:手机、电脑、家电)
          categoryDesc: string; // 品类描述
          parentId: number; // 父级ID(0表示顶级)
          status: number; // 状态
          sort: number; // 排序值
    children?: Category[];
  }

// 回收品类 API
export const CategoryApi = {
  // 查询回收品类列表
  getCategoryList: async (params) => {
    return await request.get({ url: `/recycling/category/list`, params })
  },

  // 查询回收品类详情
  getCategory: async (id: number) => {
    return await request.get({ url: `/recycling/category/get?id=` + id })
  },

  // 新增回收品类
  createCategory: async (data: Category) => {
    return await request.post({ url: `/recycling/category/create`, data })
  },

  // 修改回收品类
  updateCategory: async (data: Category) => {
    return await request.put({ url: `/recycling/category/update`, data })
  },

  // 删除回收品类
  deleteCategory: async (id: number) => {
    return await request.delete({ url: `/recycling/category/delete?id=` + id })
  },


  // 导出回收品类 Excel
  exportCategory: async (params) => {
    return await request.download({ url: `/recycling/category/export-excel`, params })
  },
}